package com.qst.controller;

import com.qst.pojo.Meeting;
import com.qst.pojo.MeetingRoom;
import com.qst.service.MeetingRoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @Author Hsing
 * @Date 2021/6/22
 */
@Controller
public class MeetingRoomController {
    @Autowired
    private MeetingRoomService meetingRoomService;
    @RequestMapping("/meetingroom")
    public String getMeetingRoom(Model model){
        List<MeetingRoom> meetingRoomList = meetingRoomService.getAllMeetingRoom();
        model.addAttribute("meetingRoomList",meetingRoomList);
        return "meetingrooms";
    }
    @RequestMapping("/meetinghistory")
    public String getMeetingHistory(Model model,int roomId){
        List<Meeting> meetingList = meetingRoomService.getMeetingHistory(roomId);
        model.addAttribute("roomName",meetingRoomService.searchMeetingRoomName(roomId));
        model.addAttribute("meetingHistory",meetingList);
        return "meetingroomdetails";
    }
}
